Skip to content

Replace Plexus XML configuration with JSR-330 annotated beans - #160

Merged
slawekjaranowski merged 2 commits into
masterfrom
jsr-330
Jul 21, 2026
Merged

Replace Plexus XML configuration with JSR-330 annotated beans#160
slawekjaranowski merged 2 commits into
masterfrom
jsr-330

Conversation

@slawekjaranowski

Copy link
Copy Markdown
Member

What changed

  • Added @Named("ToolchainsRequirement") and @Singleton annotations to ToolchainConverter
  • Created ToolchainsComponentConfigurator extending BasicComponentConfigurator — injects ToolchainConverter and registers it on initialization
  • Removed src/main/resources/META-INF/plexus/components.xml

Why

  • JSR-330 annotations with Sisu replace legacy Plexus XML component descriptors
  • sisu-maven-plugin auto-generates component indexes from annotations, eliminating manual XML maintenance
  • Cleaner, more maintainable approach with annotations co-located with code

Testing

  • All unit tests pass
  • Sisu index correctly includes both annotated beans
  • Plugin configuration remains unchanged — @Mojo(configurator = "toolchains-requirement-configurator") works as before

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Your pull request should address just one issue, without pulling in other changes.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Each commit in the pull request should have a meaningful subject line and body.
    Note that commits might be squashed by a maintainer on merge.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
    This may not always be possible but is a best-practice.
  • Run mvn verify to make sure basic checks pass.
    A more thorough check will be performed on your pull request automatically.
  • You have run the integration tests successfully (mvn -Prun-its verify).

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

## What changed
- Added `@Named("ToolchainsRequirement")` and `@Singleton` annotations to `ToolchainConverter`
- Created `ToolchainsComponentConfigurator` extending `BasicComponentConfigurator` — injects `ToolchainConverter` and registers it on initialization
- Removed `src/main/resources/META-INF/plexus/components.xml`

## Why
- JSR-330 annotations with Sisu replace legacy Plexus XML component descriptors
- `sisu-maven-plugin` auto-generates component indexes from annotations, eliminating manual XML maintenance
- Cleaner, more maintainable approach with annotations co-located with code

## Testing
- All unit tests pass
- Sisu index correctly includes both annotated beans
- Plugin configuration remains unchanged — `@Mojo(configurator = "toolchains-requirement-configurator")` works as before

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates the plugin’s custom Plexus component wiring from a components.xml descriptor to Sisu/JSR-330 annotated components, aiming to keep the @Mojo(configurator = "toolchains-requirement-configurator") behavior working without manual XML maintenance.

Changes:

  • Removed META-INF/plexus/components.xml component descriptor.
  • Added JSR-330 annotations for the ToolchainConverter and introduced a ToolchainsComponentConfigurator to register the converter.
  • Added a toString() implementation to ToolchainsRequirement.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/main/resources/META-INF/plexus/components.xml Removes legacy Plexus component descriptor wiring.
src/main/java/org/apache/maven/plugins/toolchain/ToolchainsRequirement.java Adds a toString() for easier logging/debugging.
src/main/java/org/apache/maven/plugins/toolchain/ToolchainsComponentConfigurator.java Adds an annotated configurator intended to replace the XML-based configurator/lookup wiring.
src/main/java/org/apache/maven/plugins/toolchain/ToolchainConverter.java Annotates the converter bean and adjusts conversion logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread src/it/select-jdk-toolchain-range/verify.groovy Outdated
@slawekjaranowski
slawekjaranowski merged commit 2402d77 into master Jul 21, 2026
15 checks passed
@slawekjaranowski
slawekjaranowski deleted the jsr-330 branch July 21, 2026 16:09
@github-actions github-actions Bot added this to the 3.3.0 milestone Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants